package com.njbw.user.designPattern.factoryPattern.easy;

import org.apache.commons.lang3.StringUtils;

public class ShapeFactory {

    // 使用 getShape 方法来获取形状类型的对象
    public Shape getShape(String shapeType) {
        if (StringUtils.isBlank(shapeType)) return null;
        if (shapeType.equalsIgnoreCase("CIRCLE")) {
            return new Circle();
        } else if (shapeType.equalsIgnoreCase("SQUARE")) {
            return new Square();
        } else if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        }
        return null;
    }
}
